import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from "@dfeidao/atom-web/render/render";
import paging from '@dfeidao/fd-w000010';
import p001 from './p001';

export default async function a003(fd: IFeidaoAiBrowserComponent, e: { page_no: number; }) {
	// todo
	const page_no = e.page_no;
	console.log(e);

	const n = fd.data.node.querySelector<HTMLInputElement>('[data-id="plan_list_name"]');
	const v = n.value || '';
	console.log(v);

	const data = get(fd, 'data') as { plan: string; type: string; };

	const res = await nodejs<{ res: Array<{}>; c: number; }>('plan-cb/zj-000006/s001', {
		plan_type_no: data.type,
		plan_cla_attr_no: data.plan,
		pn: page_no,
		plan_list_name: v
	});
	render(fd, res, p001, 'p001', 'inner');

	const p = fd.data.node.querySelector<paging>('[data-id="paging"]');
	p.setAttribute('page-no', page_no + '');
}
